package com.sdp.th.task;

import java.time.LocalDate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sdp.right.cron.ScheduledOfTask;
import com.sdp.th.db.th_eq_message.service.IThEqMessageService;
import com.sdp.th.entity.ThEqMessage;

@Component
public class CleanLog implements ScheduledOfTask{

	@Autowired
	private IThEqMessageService iThEqMessageService;
	
	@Override
	public void execute() {

		//原始报文数据，最多保留180天
		LambdaQueryWrapper<ThEqMessage> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.le(ThEqMessage::getCreateTime, LocalDate.now().plusDays(-180));
		iThEqMessageService.remove(queryWrapper);
		
		
		
	}

}
